﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ReportWizard.Helpers
{
    public class Digest
    {
        public static SortOrder GetSortOrder(DataGridView dgvTarget, int columnIndex)
        {
            if (dgvTarget.Columns[columnIndex].HeaderCell.SortGlyphDirection == SortOrder.None ||
                dgvTarget.Columns[columnIndex].HeaderCell.SortGlyphDirection == SortOrder.Descending)
            {
                dgvTarget.Columns[columnIndex].HeaderCell.SortGlyphDirection = SortOrder.Ascending;
                return SortOrder.Ascending;
            }
            else
            {
                dgvTarget.Columns[columnIndex].HeaderCell.SortGlyphDirection = SortOrder.Descending;
                return SortOrder.Descending;
            }
        }
    }
}
